<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id='test'>
    <h2>显示格式化的日期时间</h2>
    <p>{{startTime | data-format}}</p>
    <p>{{}}</p>
  </div>
  <script src="../js/vue.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/dayjs/1.10.5/dayjs.min.js"></script>
  <script>
    Vue.filter('data-format',(value,formatStr)=>{
      return dayjs(value).format(formatStr)
    })
    new Vue({
      el:'#test',
      data:{
        startTime:Date.now()
      }
    })
  </script>
</body>
</html>